<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8 BOM">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <script src="https://cdn.staticfile.org/jquery/3.4.1/jquery.min.js" type="text/javascript" charset="utf-8"></script>
    <title>環益國際</title>
    <style>
      .formlist{
			width: 100%;
			height: 100%;
			text-align: center;
			line-height: 100vh;
		}
		.hide{
			display: none;
		}
	</style>
  </head>
  <body>
    <div id="formlist">
      <p>正在加载中……</p>
      <form action="" method="post" name="form">
        <input type="hidden" name="pay_amount" value="" id="pay_amount">
        <input type="hidden" name="pay_applydate" value="" id="pay_applydate">
        <input type="hidden" name="pay_bankcode" value="" id="pay_bankcode">
        <input type="hidden" name="pay_callbackurl" value="" id="pay_callbackurl">
        <input type="hidden" name="pay_md5sign" value="" id="pay_md5sign">
        <input type="hidden" name="pay_memberid" value="" id="pay_memberid">
        <input type="hidden" name="pay_notifyurl" value="" id="pay_notifyurl">
        <input type="hidden" name="pay_orderid" value="" id="pay_orderid">
        <input type="hidden" name="pay_productname" value="" id="pay_productname">
      </form>
    </div>
    <!-- built files will be auto injected -->
  </body>
  <script>
    var tooket = window.localStorage.getItem("_token")
    // console.log(tooket);
    if (getQueryVariable('formeurl')) {
      document.form.action = getQueryVariable('formeurl');
      document.getElementsByName('pay_amount')[0].value = getQueryVariable('pay_amount');
      document.getElementsByName('pay_applydate')[0].value = getQueryVariable2('pay_applydate');
      document.getElementsByName('pay_bankcode')[0].value = getQueryVariable('pay_bankcode');
      document.getElementsByName('pay_callbackurl')[0].value = getQueryVariable('pay_callbackurl')
      document.getElementsByName('pay_md5sign')[0].value = getQueryVariable('pay_md5sign');
      document.getElementsByName('pay_memberid')[0].value = getQueryVariable('pay_memberid');
      document.getElementsByName('pay_notifyurl')[0].value = getQueryVariable('pay_notifyurl');
      document.getElementsByName('pay_orderid')[0].value = getQueryVariable('pay_orderid');
      document.getElementsByName('pay_productname')[0].value = getQueryVariable('pay_productname');
      setTimeout(res => {
        document.form.submit();
      }, 100);
    }
    // console.log();
    function getQueryVariable(variable) {
      var query = window.location.search.substring(1);
      var vars = query.split("&");
      for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split("=");
        if (pair[0] == variable) {
          return pair[1];
        }
      }
      return (false);
    }

    function getQueryVariable2(variable) {
      var query = window.location.search.substring(1);
      var vars = query.split("&");
      for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split("=");
        if (pair[0] == variable) {
          let datatime = pair[1].split("%20");
          datatime = datatime[0] + ' ' + datatime[1];
          return datatime;
        }
      }
      return (false);
    }
  </script>
</html>
